package guo.mybatis.dao;

import java.io.Closeable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class UserDao implements Closeable {
	private Connection connection = null;
	private PreparedStatement statement = null;

	public UserDao(Connection connection, String sql){
		this.connection = connection;
		try {
			statement = connection.prepareStatement(sql);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public PreparedStatement getStatement() {
		return statement;
	}

	public void close() {
		try {
			statement.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
}
